from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAdminUser
from goods.models import SPUSpecification, SPU
from meiduo_admin.serializers import specs
from meiduo_admin.utils import PageNum

class specsView(ModelViewSet):
    permission_classes = [IsAdminUser]
    queryset = SPUSpecification.objects.all()
    serializer_class = specs.SPUSpecificationSerializer
    pagination_class = PageNum

    def simple(self,request):
        spu = SPU.objects.all()
        ser = specs.SPUSerializer(instance=spu,many=True)

        return Response(ser.data)


